﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using proRFID_DiemDanh.Chung;
using System.Data;
using System.Data.SqlClient;

namespace proRFID_DiemDanh.LichDay
{
    public class mdLichDay
    {
        public static DataTable sp_GiaoVien_DDL(int tam)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_GiaoVien_DDL", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@tam",tam);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable sp_PhongHoc_DDL()
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_PhongHoc_DDL", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable sp_Lop_DDL()
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_Lop_DDL", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable sp_MonHoc_DDL()
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_MonHoc_DDL", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable sp_LichDay_Insert(string NgayHoc, int BuoiHoc, int MaGV, int MaPhong, int MaMH, int MaLop)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_LichDay_Insert", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@NgayHoc", NgayHoc);
            da.SelectCommand.Parameters.AddWithValue("@BuoiHoc", BuoiHoc);
            da.SelectCommand.Parameters.AddWithValue("@MaGV", MaGV);
            da.SelectCommand.Parameters.AddWithValue("@MaPhong", MaPhong);
            da.SelectCommand.Parameters.AddWithValue("@MaMH", MaMH);
            da.SelectCommand.Parameters.AddWithValue("@MaLop", MaLop);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable sp_LichDay_Select(string NgayHoc, int BuoiHoc, int MaGV, int MaPhong, int MaMH, int MaLop)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_LichDay_Select", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@NgayHoc", NgayHoc);
            da.SelectCommand.Parameters.AddWithValue("@BuoiHoc", BuoiHoc);
            da.SelectCommand.Parameters.AddWithValue("@MaGV", MaGV);
            da.SelectCommand.Parameters.AddWithValue("@MaPhong", MaPhong);
            da.SelectCommand.Parameters.AddWithValue("@MaMH", MaMH);
            da.SelectCommand.Parameters.AddWithValue("@MaLop", MaLop);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable sp_LichDay_Update(string NgayHoc, int BuoiHoc, int MaGV, int MaPhong, DateTime NgayHoc1, int BuoiHoc1, int MaGV1, int MaPhong1)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_LichDay_Update", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@NgayHoc", NgayHoc);
            da.SelectCommand.Parameters.AddWithValue("@BuoiHoc", BuoiHoc);
            da.SelectCommand.Parameters.AddWithValue("@MaGV", MaGV);
            da.SelectCommand.Parameters.AddWithValue("@MaPhong", MaPhong);

            da.SelectCommand.Parameters.AddWithValue("@NgayHoc1", NgayHoc1);
            da.SelectCommand.Parameters.AddWithValue("@BuoiHoc1", BuoiHoc1);
            da.SelectCommand.Parameters.AddWithValue("@MaGV1", MaGV1);
            da.SelectCommand.Parameters.AddWithValue("@MaPhong1", MaPhong1);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable sp_LichDay_Delete(string NgayHoc, int BuoiHoc, int MaGV, int MaPhong, int MaMH, int MaLop)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_LichDay_Delete", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@NgayHoc", NgayHoc);
            da.SelectCommand.Parameters.AddWithValue("@BuoiHoc", BuoiHoc);
            da.SelectCommand.Parameters.AddWithValue("@MaGV", MaGV);
            da.SelectCommand.Parameters.AddWithValue("@MaPhong", MaPhong);
            da.SelectCommand.Parameters.AddWithValue("@MaMH", MaMH);
            da.SelectCommand.Parameters.AddWithValue("@MaLop", MaLop);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
    }
}